<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>13-开灯关灯</title>
	</head>
	<body>
		<div id="box">黑色</div>
		<button class="btn">点击</button>
		<script type="text/javascript">
			var btn = document.querySelector('.btn');
			var box = document.getElementById('box');
			
			//想通过奇数偶数判断一下 12345678910....
			var i = 1;
			btn.onclick = function(){
				//alert(1);
				if(i%2==0){
					box.innerHTML = '白色';
				}else{
					box.innerHTML = '黑色';
				}
				console.log('I::'+i);
				i++;
			}
		</script>
	</body>
</html>
